#include "stdafx.hpp"
#include "ColligereListCtrl.hpp"

IMPLEMENT_DYNAMIC_CLASS ( ColligereListCtrl, wxListCtrl );

ColligereListCtrl::ColligereListCtrl()
{

}

ColligereListCtrl::ColligereListCtrl ( wxWindow *pParent, wxWindowID id, 
									  const wxPoint &rPos,  const wxSize &rSize, 
									  long style, const wxValidator &rValidator, 
									  const wxString &rName ) : wxListCtrl ( pParent, 
									  id, rPos, rSize, style, rValidator, rName )
{

}

void ColligereListCtrl::SetColumnText ( long indx, long column, 
									   const wxString &rText )
{
	wxListItem list_item;
	list_item.SetId ( indx );
	list_item.SetColumn ( column );
	list_item.SetMask ( wxLIST_MASK_TEXT );
	list_item.SetText ( rText );
	SetItem ( list_item );
}

const wxString ColligereListCtrl::GetColumnText ( long indx, long column ) const
{
	wxListItem list_item;
	list_item.SetId ( indx );
	list_item.SetColumn ( column );
	list_item.SetMask ( wxLIST_MASK_TEXT );
	GetItem ( list_item );
	return list_item.GetText();
}

long ColligereListCtrl::GetSelectedItem() const
{
	return GetNextItem ( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
}

void ColligereListCtrl::SelectItem ( long indx )
{
	SetItemState ( indx, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
}

void ColligereListCtrl::UnselectActiveItem()
{
	SetItemState ( GetSelectedItem(), 0, wxLIST_STATE_SELECTED );
}